# 8.4 非web环境使用RedisPlugin
RedisPlugin也可以在非web环境下使用,只需引入jfinal.jar然后多调用一下redisPlugin.start()即可,以下是代码示例:
public class RedisTest {
public static void main(String[] args) {
RedisPlugin rp = new RedisPlugin("myRedis", "localhost");
// 与web下唯一区别是需要这里调用一次start()方法
rp.start();
Redis.use().set("key", "value");
Redis.use().get("key");
}
}
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10